package com.project.enums;

public enum ApprovalsCurrentSepEnum {
    TEAM(0, "班组长"),
    METERIAL(1, "材料员"),
    ACCEPTANCE(2, "验收监理"),
    MANAGER(2, "项目经理");

    private final int code;
    private final String name;

    ApprovalsCurrentSepEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    // 根据 code 获取枚举（用于数据库反查）
    public static ApprovalsCurrentSepEnum fromCode(int code) {
        for (ApprovalsCurrentSepEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知审批状态码: " + code);
    }

    // 根据 code 获取名称（直接供外部调用）
    public static String getStatusName(int code) {

        return fromCode(code).name;
    }
}
